<%@page language="java" contentType="text/html"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@page import="java.util.ArrayList"%>
<%@ page import="java.util.*" %>
<%@ page import="Personal.Person" %>
<%@ page import="Personal.Doctor" %>
<%@ page import="Personal.Patient" %>
<fmt:setBundle basename="hospital"/>
<html>
<head>
<title>Doctors contacts</title>
</head>

<body>
<jsp:useBean id="sessionUser" scope="session" class="Person"/>
<h2><fmt:message key="logged_in"/>:<a href="/show.do?id=${sessionUser.idPerson}">"${sessionUser.name}"</a><h2>

<jsp:useBean id="displayedUser" scope="request" class="Doctor"/>
<h3><fmt:message key="patients"/> "${displayedUser.name}"</h3>

<ul>
<c:forEach var="patient" items="${displayedUser.patients}">
    <li>
        <a href="/show.do?id=${patient.idPerson}">${patient.name}</a>
    </li>
</c:forEach>
</ul>

<h3><fmt:message key="colleagues"/>:</h3>
<c:set var="dUserId" value="${displayedUser.idPerson}"  scope="request"></c:set>
<ul>
<c:forEach var="doc" items="${displayedUser.department.doctors}">
    <c:if test="${doc.idPerson != dUserId}">
    	<li>
    	    <a href="/show.do?id=${doc.idPerson}">${doc.name}</a>
    	</li>
    </c:if>
</c:forEach>
</ul>
</body>
</html>